<script setup>
import { ref, reactive, defineEmits } from 'vue'

/**
 *  ButtonList 枚举数据  [ { type:add,hasPermi:'system:user:add'} ]
 */
const props = defineProps({
  ButtonList: {
    type: Array,
    default: () => []
  },
  loading: {
    type: Boolean,
    default: false
  }
})

// 按钮 子穿父触发事件
const Emit = defineEmits([
  'Zdy',
  'ZdyTwo',
  'addTwo',
  'EditTwo',
  'deleteTwo',
  'add',
  'Edit',
  'delete',
  'Import',
  'Export',
  'Update'
])
</script>

<template>
  <el-row :gutter="10" class="mb8">
    <div v-for="(item, index) in props.ButtonList" :key="index">
      <el-col :span="1.5" v-if="item.type == 'add'">
        <el-button type="primary" plain icon="Plus" @click="Emit('add')" v-hasPermi="[item.hasPermi]">{{
          item.label || '新增'
        }}</el-button>
      </el-col>
      <el-col :span="1.5" v-if="item.type == 'addTwo'">
        <el-button
          type="primary"
          plain
          icon="Plus"
          :disabled="item.Multiple"
          @click="Emit('addTwo')"
          v-hasPermi="[item.hasPermi]"
          >{{ item.label || '新增' }}</el-button
        >
      </el-col>
      <el-col :span="1.5" v-if="item.type == 'edit'">
        <el-button
          type="success"
          plain
          icon="Edit"
          :disabled="item.Single"
          @click="Emit('Edit')"
          v-hasPermi="[item.hasPermi]"
          >{{ item.label || '修改' }}</el-button
        >
      </el-col>
      <el-col :span="1.5" v-if="item.type == 'editTwo'">
        <el-button
          type="success"
          plain
          icon="Edit"
          :disabled="item.Single"
          @click="Emit('editTwo')"
          v-hasPermi="[item.hasPermi]"
          >{{ item.label || '修改' }}</el-button
        >
      </el-col>
      <el-col :span="1.5" v-if="item.type == 'remove'">
        <el-button
          type="danger"
          plain
          icon="Delete"
          :disabled="item.Multiple"
          @click="Emit('delete')"
          v-hasPermi="[item.hasPermi]"
          >{{ item.label || '批量删除' }}</el-button
        >
      </el-col>
      <el-col :span="1.5" v-if="item.type == 'removeTwo'">
        <el-button
          type="danger"
          plain
          icon="Delete"
          :disabled="item.Multiple"
          @click="Emit('removeTwo')"
          v-hasPermi="[item.hasPermi]"
          >{{ item.label || '批量删除' }}</el-button
        >
      </el-col>
      <el-col :span="1.5" v-if="item.type == 'import'">
        <el-button type="info" plain icon="Upload" @click="Emit('Import')" v-hasPermi="[item.hasPermi]">{{
          item.label || '导入'
        }}</el-button>
      </el-col>
      <el-col :span="1.5" v-if="item.type == 'export'">
        <el-button type="warning" plain icon="Download" @click="Emit('Export')" v-hasPermi="[item.hasPermi]">{{
          item.label || '导出'
        }}</el-button>
      </el-col>
      <el-col :span="1.5" v-if="item.type == 'zdy'">
        <el-button type="warning" plain :disabled="item.Multiple" @click="Emit('zdy')" v-hasPermi="[item.hasPermi]">{{
          item.label || '空'
        }}</el-button>
      </el-col>
      <el-col :span="1.5" v-if="item.type == 'zdyTwo'">
        <el-button
          type="warning"
          plain
          :disabled="item.Multiple"
          @click="Emit('zdyTwo')"
          v-hasPermi="[item.hasPermi]"
          >{{ item.label || '空' }}</el-button
        >
      </el-col>
    </div>

    <!-- <right-toolbar v-model:showSearch="showSearch" @queryTable="getList" :columns="columns"></right-toolbar> -->
  </el-row>
</template>
